package com.example;

public class LC1_1 {
    public static void main(String[] args) {
        int[] arr = {1,1,2};
        removeDuplicates(arr);
    }
    public static int removeDuplicates(int[] nums) {
        int currLen = nums.length;
        if(currLen <= 1) return currLen;
        int left = 0;
        int right = 1;
        while(right <= nums.length-1) {
            while(nums[right] == nums[left]) {
                if(right == nums.length-1) return left+1;
                right++;
            }
            left++;
            nums[left] = nums[right];
        }
        return left+1;
    }
}
